################################################################################
##
##  Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
##  Version 2.x, Copyright (C) 2001, Paul Marquess.
##  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
##
##  This program is free software; you can redistribute it and/or
##  modify it under the same terms as Perl itself.
##
################################################################################

=provides

__UNDEFINED__
aTHXR
aTHXR_
dTHXR

=implementation

__UNDEFINED__  dTHR       dNOOP

__UNDEFINED__  dTHX       dNOOP
__UNDEFINED__  dTHXa(x)   dNOOP

__UNDEFINED__  pTHX       void
__UNDEFINED__  pTHX_
__UNDEFINED__  aTHX
__UNDEFINED__  aTHX_

#if { VERSION < 5.6.0 }
#  ifdef USE_THREADS
#    define aTHXR  thr
#    define aTHXR_ thr,
#  else
#    define aTHXR
#    define aTHXR_
#  endif
#  define dTHXR  dTHR
#else
#  define aTHXR  aTHX
#  define aTHXR_ aTHX_
#  define dTHXR  dTHX
#endif

__UNDEFINED__  dTHXoa(x)  dTHXa(x)

=xsubs

IV
no_THX_arg(sv)
        SV *sv
        CODE:
                RETVAL = 1 + sv_2iv(sv);
        OUTPUT:
                RETVAL

void
with_THX_arg(error)
        char *error
        PPCODE:
                Perl_croak(aTHX_ "%s", error);

=tests plan => 2

ok(&Devel::PPPort::no_THX_arg("42"), 43);
eval { &Devel::PPPort::with_THX_arg("yes\n"); };
ok($@ =~ /^yes/);
